package com.hongkuncheng.cms.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hongkuncheng.cms.helper.TokenHelper;
import org.springframework.web.servlet.HandlerInterceptor;

public class OrganizationInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        if (!TokenHelper.validate(request.getParameter("token"))) {
            response.getWriter().print(0);
            return false;
        }
        return HandlerInterceptor.super.preHandle(request, response, handler);
    }

}
